'use strict';

const Controller = require('egg').Controller;
const svgCaptcha = require('svg-captcha');

class HomeController extends Controller {
  async index() {
    const { ctx } = this;
    
    var captcha = svgCaptcha.create();
    ctx.session.captcha = captcha.text;
    
    ctx.response.type='svg';
    ctx.body = captcha.data;
  }
}

module.exports = HomeController;
